local Class = require('lua.lang.Class')
local LuaNumber = require('lua.vm.LuaNumber')

--- @class ExpressionValue
--- @field rkIdx number
--- @field tIdx number
--- @field valueTypeIndex number
--- @field numericValue LuaValue
--- @field opcodeInfo number
local ExpressionValue = Class {}

--- @constructor
--- @return ExpressionValue
function ExpressionValue:new()
	--- @type ExpressionValue
	local o = {}
	o.rkIdx = 0
	o.tIdx = 0
	o.valueTypeIndex = 0
	o.numericValue = nil
	o.opcodeInfo = 0
	return setmetatable(o, ExpressionValue)
end

--- @param r LuaValue
--- @return void
function ExpressionValue:setNumericValue(r)
	self.numericValue = r
end

--- @return LuaValue
function ExpressionValue:getNumericValue()
	return self.numericValue == nil and LuaNumber:valueOf(self.opcodeInfo) or self.numericValue
end

return ExpressionValue